package LeaveRequest_Handler_20;

public abstract class LeaveHandler {
    protected LeaveHandler nextHandler; // 下一个处理者

    public void setNextHandler(LeaveHandler nextHandler) {
        this.nextHandler = nextHandler;
    }

    public abstract void handleRequest(LeaveRequest request);

    protected void passToNext(LeaveRequest request) {
        if (nextHandler != null) {
            nextHandler.handleRequest(request);
        } else {
            System.out.println("没有更多的处理者，无法处理请求。");
        }
    }
}
